home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / Ecore_Config.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-01-09  |  13.0 KB  |  299 lines

  1. #ifndef _ECORE_CONFIG_H
  2. # define _ECORE_CONFIG_H
  3.  
  4. #ifdef EAPI
  5. #undef EAPI
  6. #endif
  7. #ifdef WIN32
  8. # ifdef BUILDING_DLL
  9. #  define EAPI __declspec(dllexport)
  10. # else
  11. #  define EAPI __declspec(dllimport)
  12. # endif
  13. #else
  14. # ifdef __GNUC__
  15. #  if __GNUC__ >= 4
  16. #   define EAPI __attribute__ ((visibility("default")))
  17. #  else
  18. #   define EAPI
  19. #  endif
  20. # else
  21. #  define EAPI
  22. # endif
  23. #endif
  24.  
  25. /**
  26.  * @file 
  27.  * @brief Provides the Enlightened Property Library.
  28.  *
  29.  * This file provies all headers and structs for use with Ecore_Config.
  30.  * Using individual header files should not be necessary.
  31.  */
  32.  
  33. # define DIR_DELIMITER      '/'
  34. # define ECORE_CONFIG_FLOAT_PRECISION 1000
  35.  
  36. /* FIXME: this should only be included if evas is present */
  37. # include <Evas.h>
  38.  
  39. # define ECORE_CONFIG_GLOBAL_ID "_system"
  40.  
  41. /* structures */
  42.  
  43. /**
  44.  * Valid configuration property types.
  45.  */
  46. typedef enum Ecore_Config_Type
  47. {
  48.    ECORE_CONFIG_NIL = 0,            /**< Property with no value. */
  49.    ECORE_CONFIG_INT = 1,            /**< Integer property type. */
  50.    ECORE_CONFIG_FLT = 2,            /**< Float property type. */
  51.    ECORE_CONFIG_STR = 3,            /**< String property type. */
  52.    ECORE_CONFIG_RGB = 4,            /**< Colour property type. */
  53.    ECORE_CONFIG_THM = 5,            /**< Theme property type. */
  54.    ECORE_CONFIG_BLN = 6,            /**< Boolean property type. */
  55. } Ecore_Config_Type;
  56.  
  57. typedef enum Ecore_Config_Flag
  58. {
  59.    ECORE_CONFIG_FLAG_NONE = 0,
  60.    ECORE_CONFIG_FLAG_BOUNDS = 1,
  61.    ECORE_CONFIG_FLAG_MODIFIED = 2,
  62.    ECORE_CONFIG_FLAG_SYSTEM = 4,
  63.    ECORE_CONFIG_FLAG_CMDLN = 8
  64. } Ecore_Config_Flag;
  65.  
  66. /**
  67.  * Property change callback function prototype.
  68.  */
  69. typedef int         (*Ecore_Config_Listener) (const char *key,
  70.                           const Ecore_Config_Type type,
  71.                           const int tag, void *data);
  72.  
  73. typedef struct Ecore_Config_Listener_List
  74. {
  75.    Ecore_Config_Listener listener;
  76.    const char         *name;
  77.    void               *data;
  78.    int                 tag;
  79.    struct Ecore_Config_Listener_List *next;
  80. } Ecore_Config_Listener_List;
  81.  
  82. /**
  83.  * The actual property for storing a key-value pair.
  84.  */
  85. typedef struct Ecore_Config_Prop
  86. {
  87.    char               *key;    /* Property key. */
  88.    char               *description;    /* Description set by ecore_config_descibe. */
  89.    char                short_opt;    /* short identifier on command line (-f) */
  90.    char               *long_opt;    /* long identifier on command line (--foo) */
  91.    char               *ptr;    /* Used as the value when the property is a string or theme. */
  92.    Ecore_Config_Type   type;    /* Property type. */
  93.    long                val;    /* Used as the value when the property is an integer, float or colour. */
  94.    long                lo;    /* Lower bound for the value when the property is an integer or float. */
  95.    long                hi;    /* Higher bound for the value when the property is an integer or float. */
  96.    long                step;    /* Increment for the value when the property is an integer or float. */
  97.    Ecore_Config_Flag   flags;    /// < Configuration flags.
  98.    Ecore_Config_Listener_List *listeners;    /* List of change listeners. */
  99.    void               *data;    /// < Stores extra data for the property.
  100.    struct Ecore_Config_Prop *next;    /* Pointer to the next property in the list. */
  101. } Ecore_Config_Prop;
  102.  
  103. /*
  104.  * A container for a list of properties.  Provided so that an
  105.  * application can use different set of properties at any time. This
  106.  * is useful for multiple window support.
  107.  */
  108. typedef struct Ecore_Config_Bundle
  109. {
  110.    char               *identifier;    /* Identifier for this set of properties (window ID for example) */
  111.    char               *owner;    /* This is used to store the application name related to the bundle */
  112.    long                serial;    /* Unique identifier to identify bundle */
  113.    Ecore_Config_Prop  *data;    /* Pointer to root of property list */
  114.    void               *user_data;    /* App specific pointer to "other data" */
  115.    struct Ecore_Config_Bundle *next;    /* Pointer to next bundle in this application */
  116. } Ecore_Config_Bundle;
  117.  
  118. typedef struct Ecore_Config_Server
  119. {
  120.    void               *server;
  121.    char               *name;
  122.    Ecore_Config_Bundle *bundles;    /* data anchor */
  123.    struct Ecore_Config_Server *next;
  124. } Ecore_Config_Server;
  125.  
  126. # ifdef __cplusplus
  127. extern              "C"
  128. {
  129. # endif
  130.  
  131. /* global ptrs to save passing them through the API */
  132.    EAPI extern Ecore_Config_Server *__ecore_config_server_global;
  133.    EAPI extern Ecore_Config_Server *__ecore_config_server_local;
  134.    EAPI extern Ecore_Config_Bundle *__ecore_config_bundle_local;
  135.    EAPI extern char        *__ecore_config_app_name;
  136.  
  137.    EAPI Ecore_Config_Prop  *ecore_config_get(const char *key);
  138.    EAPI const char         *ecore_config_type_get(const Ecore_Config_Prop *e);
  139.    EAPI int                 ecore_config_boolean_get(const char *key);
  140.    EAPI char               *ecore_config_string_get(const char *key);
  141.    EAPI long                ecore_config_int_get(const char *key);
  142.    EAPI int                 ecore_config_argb_get(const char *key, int *a, int *r,
  143.                           int *g, int *b);
  144.    EAPI char               *ecore_config_argbstr_get(const char *key);
  145.    EAPI float               ecore_config_float_get(const char *key);
  146.    EAPI char               *ecore_config_theme_get(const char *key);
  147.    EAPI char               *ecore_config_as_string_get(const char *key);
  148.    EAPI int                 ecore_config_bound(Ecore_Config_Prop *e);
  149.    EAPI int                 ecore_config_describe(const char *key, char *desc);
  150.    EAPI int                 ecore_config_short_opt_set(const char *key,
  151.                                char short_opt);
  152.    EAPI int                 ecore_config_long_opt_set(const char *key,
  153.                               char *long_opt);
  154.    EAPI int                 ecore_config_set(const char *key, char *val);
  155.    EAPI int                 ecore_config_typed_set(const char *key, const void *val,
  156.                            int type);
  157.    EAPI int                 ecore_config_boolean_set(const char *key, int val);
  158.    EAPI int                 ecore_config_string_set(const char *key, char *val);
  159.    EAPI int                 ecore_config_int_set(const char *key, int val);
  160.    EAPI int                 ecore_config_argb_set(const char *key, int a, int r, int g, int b);
  161.    EAPI int                 ecore_config_argbstr_set(const char *key, char *val);
  162.    EAPI int                 ecore_config_float_set(const char *key, float val);
  163.    EAPI int                 ecore_config_theme_set(const char *key, char *val);
  164.    EAPI int                 ecore_config_theme_preview_group_set(const char *key,
  165.                                  char *group);
  166.    EAPI int                 ecore_config_as_string_set(const char *key, char *val);
  167.  
  168.    EAPI int                 ecore_config_default(const char *key, char *val,
  169.                          float lo, float hi, float step);
  170.    EAPI int                 ecore_config_typed_default(const char *key, void *val,
  171.                                int type);
  172.    EAPI int                 ecore_config_boolean_default(const char *key, int val);
  173.    EAPI int                 ecore_config_int_default(const char *key, int val);
  174.    EAPI int                 ecore_config_int_default_bound(const char *key, int val,
  175.                                int lo, int hi, int step);
  176.    EAPI int                 ecore_config_string_default(const char *key, const char *val);
  177.    EAPI int                 ecore_config_float_default(const char *key, float val);
  178.    EAPI int                 ecore_config_float_default_bound(const char *key,
  179.                                  float val, float lo,
  180.                                  float hi, float step);
  181.    EAPI int                 ecore_config_argb_default(const char *key, int a, int r, int g, int b);
  182.    EAPI int                 ecore_config_argbstr_default(const char *key, char *val);
  183.    EAPI int                 ecore_config_theme_default(const char *key, char *val);
  184.  
  185.    EAPI int                 ecore_config_listen(const char *name, const char *key,
  186.                         Ecore_Config_Listener listener,
  187.                         int tag, void *data);
  188.    EAPI int                 ecore_config_deaf(const char *name, const char *key,
  189.                           Ecore_Config_Listener listener);
  190.    EAPI Ecore_Config_Prop  *ecore_config_dst(Ecore_Config_Prop *e);
  191.    EAPI int                 ecore_config_type_guess(const char *key, const char *val);
  192.  
  193.    EAPI Ecore_Config_Bundle *ecore_config_bundle_new(Ecore_Config_Server *srv,
  194.                              const char *id);
  195.    EAPI Ecore_Config_Bundle *ecore_config_bundle_1st_get(Ecore_Config_Server *srv);
  196.    EAPI Ecore_Config_Bundle *ecore_config_bundle_next_get(Ecore_Config_Bundle *ns);
  197.    EAPI Ecore_Config_Bundle *ecore_config_bundle_by_serial_get(Ecore_Config_Server *srv,
  198.                                    long serial);
  199.    EAPI Ecore_Config_Bundle *ecore_config_bundle_by_label_get(Ecore_Config_Server *srv,
  200.                                   const char *label);
  201.    EAPI long                ecore_config_bundle_serial_get(Ecore_Config_Bundle *ns);
  202.    EAPI char               *ecore_config_bundle_label_get(Ecore_Config_Bundle *ns);
  203.  
  204.    EAPI int                 ecore_config_init(const char *name);
  205.    EAPI int                 ecore_config_shutdown(void);
  206.  
  207.    EAPI int                 ecore_config_system_init(void);
  208.    EAPI int                 ecore_config_system_shutdown(void);
  209.  
  210.    EAPI int                 ecore_config_load(void);
  211.    EAPI int                 ecore_config_file_load(const char *file);
  212.    EAPI int                 ecore_config_save(void);
  213.    EAPI int                 ecore_config_file_save(const char *file);
  214.  
  215. /* error codes */
  216. # define ECORE_CONFIG_ERR_NOTSUPP     (-16)
  217. # define ECORE_CONFIG_ERR_NOFILE      (-15)
  218. # define ECORE_CONFIG_ERR_META_DLFAIL (-14)
  219. # define ECORE_CONFIG_ERR_META_FILE   (-13)
  220. # define ECORE_CONFIG_ERR_META_FORMAT (-12)
  221. # define ECORE_CONFIG_ERR_MONMIS      (-11)
  222. # define ECORE_CONFIG_ERR_NOEXEC      (-10)
  223. # define ECORE_CONFIG_ERR_PARTIAL      (-9)
  224. # define ECORE_CONFIG_ERR_PATHEX       (-8)
  225. # define ECORE_CONFIG_ERR_TYPEMISMATCH (-7)
  226. # define ECORE_CONFIG_ERR_MUTEX        (-6)
  227. # define ECORE_CONFIG_ERR_NOTFOUND     (-5)    /* Error indicating that the item searched for could not be found. */
  228. # define ECORE_CONFIG_ERR_OOM          (-4)    /* Error given when the program runs out of memory. */
  229. # define ECORE_CONFIG_ERR_IGNORED      (-3)    /* Error occurred, but was ignored. */
  230. # define ECORE_CONFIG_ERR_NODATA       (-2)    /* Error given when necessary data is not provided. */
  231. # define ECORE_CONFIG_ERR_FAIL         (-1)    /* Failure result. */
  232. # define ECORE_CONFIG_ERR_SUCC          (0)    /* Success result. */
  233.  
  234. # define ECORE_CONFIG_PARSE_HELP       (-2)    /* Help was displayed */
  235. # define ECORE_CONFIG_PARSE_EXIT       (-1)    /* An error occurred */
  236. # define ECORE_CONFIG_PARSE_CONTINUE    (0)    /* Arguments parsed successfully */
  237.  
  238. /* convenience mathods in convenience.c */
  239.    /* FIXME: this should only be included if evas is present */
  240.    EAPI int                 ecore_config_evas_font_path_apply(Evas *evas);
  241.    EAPI char               *ecore_config_theme_search_path_get(void);
  242.    EAPI int                 ecore_config_theme_search_path_append(char *append);
  243.      
  244.    EAPI char               *ecore_config_theme_default_path_get(void);
  245.    EAPI char               *ecore_config_theme_with_path_from_name_get(char *name);
  246.    EAPI char               *ecore_config_theme_with_path_get(const char *key);
  247.    EAPI void                ecore_config_args_display(void);
  248.    EAPI int                 ecore_config_args_parse(void);
  249.    EAPI void                ecore_config_args_callback_str_add(char short_opt,
  250.                                    char *long_opt, char *desc,
  251.                                    void (*func)(char *val, void *data),
  252.                                    void *data);
  253.    EAPI void                ecore_config_args_callback_noarg_add(char short_opt,
  254.                                  char *long_opt, char *desc,
  255.                                  void (*func)(char *val, void *data),
  256.                                  void *data);
  257.    EAPI void                ecore_config_app_describe(char *description);
  258.  
  259.    EAPI int                 ecore_config_create(const char *key, void *val,
  260.                         char short_opt, char *long_opt,
  261.                         char *desc);
  262.    EAPI int                 ecore_config_typed_create(const char *key, void *val,
  263.                               int type, char short_opt,
  264.                               char *long_opt, char *desc);
  265.    EAPI int                 ecore_config_boolean_create(const char *key, int val,
  266.                             char short_opt, char *long_opt,
  267.                             char *desc);
  268.    EAPI int                 ecore_config_int_create(const char *key, int val,
  269.                             char short_opt, char *long_opt,
  270.                             char *desc);
  271.    EAPI int                 ecore_config_int_create_bound(const char *key, int val,
  272.                               int low, int high,
  273.                               int step, char short_opt,
  274.                               char *long_opt,
  275.                               char *desc);
  276.    EAPI int                 ecore_config_string_create(const char *key, char *val,
  277.                                char short_opt,
  278.                                char *long_opt, char *desc);
  279.    EAPI int                 ecore_config_float_create(const char *key, float val,
  280.                               char short_opt, char *long_opt,
  281.                               char *desc);
  282.    EAPI int                 ecore_config_float_create_bound(const char *key,
  283.                                 float val, float low,
  284.                                 float high, float step,
  285.                                 char short_opt,
  286.                                 char *long_opt,
  287.                                 char *desc);
  288.    EAPI int                 ecore_config_argb_create(const char *key, char *val,
  289.                              char short_opt, char *long_opt,
  290.                              char *desc);
  291.    EAPI int                 ecore_config_theme_create(const char *key, char *val,
  292.                               char short_opt, char *long_opt,
  293.                               char *desc);
  294.  
  295. # ifdef __cplusplus
  296. }
  297. # endif
  298. #endif
  299.